﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormProject.Depo
{
    public partial class TransferEvrakListesiFrm : Form
    {
        public TransferEvrakListesiFrm()
        {
            InitializeComponent();
        }
        DBBaglantiDataContext db = new DBBaglantiDataContext();
        public Form AcanForm = null;
        private void TransferEvrakListesiFrm_Load(object sender, EventArgs e)
        {

            dataGridView1.DataSource = (from x in db.StokHaraketleris
                                        join z in db.Subelers on x.StokHaraketGonderenSubeID equals z.SubeID

                                        group x by new { z.SubeAdi, x.StokHaraketIrsaliyeNo, x.StokHaraketHaraketTuru, x.StokHaraketTarih } into g
                                        select new { g.Key.StokHaraketTarih, g.Key.StokHaraketIrsaliyeNo, g.Key.SubeAdi, g.Key.StokHaraketHaraketTuru }).ToList();


        }

        private void dataGridView1_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (AcanForm != null)
            {

                if (AcanForm.Name == "UrunTransferFrm")
                {
                    UrunTransferFrm frm = Application.OpenForms["UrunTransferFrm"] as UrunTransferFrm;
                    if (frm != null)
                    {
                        frm.StokHaraketIrsaliyeNo.Text = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
                        frm.Evrakgetir(frm.StokHaraketIrsaliyeNo.Text);
                        frm.UrunID.Text = string.Empty;
                        frm.UrunAdi.Text = string.Empty;
                        frm.StokHaraketAdet.Text = "0.00";
                        this.Close();
                    }
                }
            }

        }
    }
}
